#ifndef _CAPTURE_H_
#define _CAPTURE_H_

#include <pthread.h>
#include "comm_video.h"
#include "hi_type.h"
#include "ive.h"
#include "jpeglib.h"
#include "network_common.h"
#include "network_info.h"

typedef struct {
    NetworkConfigStorageSnapParam CaptureInfo;
    pthread_mutex_t lock;  // 互斥锁
} CaptureInfo_S;

// 初始化抓拍状态
void capture_state_init(CaptureInfo_S *state);

// 设置抓拍开关
void set_capture_config(CaptureInfo_S *state, const NetworkConfigStorageSnapParam *new_config);
// void set_capture_flag(CaptureInfo_S *state, NetworkConfigStorageSnapParam *default_info);

// 获取抓拍开关状态
NetworkConfigStorageSnapParam get_capture_config(CaptureInfo_S *state);
// int get_capture_flag(CaptureInfo_S *state);

int save_snap_info_to_ini(const NetworkConfigStorageSnapParam *snap_info);

int load_snap_info_from_ini(NetworkConfigStorageSnapParam *snap_info);

// 抓拍线程函数
void* capture_thread(void *arg);

int yuv_to_bgr_packet(VIDEO_FRAME_INFO_S *FrameInfo, unsigned char *dst);
#endif